package main

import (
	"fmt"
	"net"
)

func Write(conn net.Conn, txt string) {

	conn.Write([]byte(fmt.Sprintf("%05d", len(txt))))
	conn.Write([]byte(txt))
	// return
}

func main() {
	conn, err := net.Dial("tcp", "127.0.0.1:8989")
	if err != nil {
		fmt.Println(err)
		return
	}

	var txt string
	fmt.Scanf("发送：%s", &txt)

	Write(conn, "你好")

	conn.Close()

}
